<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>okMd5</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../css/oksub.css">
</head>
<body>
    <div class="ok-body">
        <blockquote class="layui-elem-quote">
            <p>JavaScript版本的MD5实现</p>
        </blockquote>
        <pre>
layui.use(["okMd5"], function () {
    let okMd5 = layui.okMd5;
    <br/>

    // 计算给定字符串值的（十六进制编码的）MD5哈希值
    let hash = okMd5("hello");
    console.log(hash);

    // 计算给定字符串值和key的（十六进制编码的）HMAC-MD5哈希值
    let hash2 = okMd5("hello", "word");
    console.log(hash2);

    // 计算给定字符串值的原始MD5哈希值
    let hash3 = okMd5("hello", null, true)
    console.log(hash3);

    // 计算给定字符串值和key的原始HMAC-MD5哈希值
    let hash4 = okMd5("hello", "word", true)
    console.log(hash4);
});
        </pre>
    </div>
    <!--js逻辑-->
    <script src="../../lib/layui/layui.js"></script>
    <script>
        layui.use(["code", "okMd5"], function () {
            let code = layui.code;
            let okMd5 = layui.okMd5;

            code({
                elem: "pre",
                title: "代码示例"
            });

            // 计算给定字符串值的（十六进制编码的）MD5哈希值
            let hash = okMd5("hello");
            console.log(hash);

            // 计算给定字符串值和key的（十六进制编码的）HMAC-MD5哈希值
            let hash2 = okMd5("hello", "word");
            console.log(hash2);

            // 计算给定字符串值的原始MD5哈希值
            let hash3 = okMd5("hello", null, true)
            console.log(hash3);

            // 计算给定字符串值和key的原始HMAC-MD5哈希值
            let hash4 = okMd5("hello", "word", true)
            console.log(hash4);
        });
    </script>
</body>
</html>
